/*******************************************************************************
*  file    : mainwindow.hpp
*  created : 20.07.2013
*  author  : 
*******************************************************************************/

#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP

#include <QMainWindow>
#include <QPointer>


namespace Ui {
class smsMainWindow;
}

class QAction;
class QTableView;
class QSplitter;
class DeviceModel;
class DeviceProxyModel;
class DeviceStatusBoard;
class QSpreadsheetHeaderView;
class Maps;
class QBusyDialog;

class smsMainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit smsMainWindow(QWidget *parent = 0);
    ~smsMainWindow();
protected:
    void closeEvent(QCloseEvent *);
    void saveSettings();
    void restoreSettings();
    void createActions();
    void createToolBar();
    void createMenu();
    QStringList chooseIndexes();
protected slots:
    void showAbout         ();
    void showSettings      ();
    void showAddDialog     ();
    void showEditDialog    ();
    void showHideDialog    ();
    void testRpcEcho       ();
    void testSmsOutgoing   ();

    void sendInfoRequest   ();
    void sendPosRequest    ();
    void sendMode0Request  ();
    void sendMode1Request  ();

    void serverStateChanged(bool);
    void modemStatusChanged(const QString& ms);

    void testMenuAction();
    void _testAddMarker();
private slots:
    void showBusyDialog(const QString& txt);
    void hideBusyDialog();
    void timeoutBusyDialog();
private:
    Ui::smsMainWindow *ui;

    QAction*        about_act_;
    QAction*        settings_act_;
    QAction*        add_mole_act_;
    QAction*        hide_mole_act_;
    QAction*        edit_mole_act_;

    QAction*        tst_sms_act_;
    QAction*        info_sms_act_;
    QAction*        pos_sms_act_;
    QAction*        mode0_sms_act_;
    QAction*        mode1_sms_act_;

    QAction*        sort_AZ_act_;
    QAction*        sort_SMS_date_act_;
    QAction*        sort_bat_act_;
    QAction*        sort_color_act_;
    QAction*        sort_bat_ch_act_;

    DeviceModel*            model_;
    DeviceProxyModel*       proxy_model_;
    QSplitter*              splitter_;
    QSplitter*              dev_splitter_;
    Maps*                   maps_;
    QTableView*             dev_table_;
    QSpreadsheetHeaderView* header_view_;
    DeviceStatusBoard*      dev_board_;

    QString                 server_status_;
    QString                 modem_status_;

    QPointer<QBusyDialog>   busy_dialog_;
    QTimer*                 busy_timer_;
    int                     task_counter_;
};

#endif // MAINWINDOW_HPP
